-
Notifications
You must be signed in to change notification settings - Fork 7.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ZOOKEEPER-4475: Fix NodeChildrenChanged delivered to recursive watcher #1820
ZOOKEEPER-4475: Fix NodeChildrenChanged delivered to recursive watcher #1820
Conversation
Ping @eolivelli @Randgalt for review. |
Another ping @eolivelli @Randgalt @symat @maoling for review. |
4751fab
to
de934cc
Compare
@eolivelli @Randgalt @symat @maoling @arshadmohammad @anmolnar Anyone have time capacity to review this pr ? I think @Randgalt has confirmed this as bug in ZOOKEEPER-4466. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kezhuw Thanks for your contribution!
Generally looks good. Comments inline.
zk.create("/a/b/c", new byte[0], ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); | ||
|
||
assertEvent(events, Watcher.Event.EventType.NodeCreated, "/a/b"); | ||
assertEvent(events, Watcher.Event.EventType.NodeCreated, "/a/b/c"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may assert no outstanding event here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add assertTrue(events.isEmpty())
to assert that no more events in queue.
synchronized (persistentWatches) { | ||
addTo(persistentWatches.get(clientPath), result); | ||
} | ||
if (type == Watcher.Event.EventType.NodeChildrenChanged) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A comment about reason to filter NodeChildrenChanged
event helps - it's not quite straightforward.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add comments to explain why this is necessary and why this must be done in client side.
Some other concerns:
In this patch we filter event on the client side, which has nothing to do with server side logics.
|
@tisonkun Thank you for reviews. I have pushed fixup commit to resolve your comments. Regarding your concerns, I try to reply them here:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
f7bb53e
to
1c5e5ee
Compare
@tisonkun would you have time to test if Curator still works well with this change ? like running all the tests of Curator |
|
@eolivelli I'll try to do a local test this week. Ping me if I miss it :) |
@eolivelli since Curator doesn't support ZK 3.7+, I'm trying to pick this commit to 3.6.4-SNAPSHOT and run tests. However, I get a compile error when build with 3.6.4:
I have no idea whether this failure comes from. |
Hi @eolivelli, I have done a test based on #1859(which is a superset of this pr) and apache/curator#426 on branch-3.7. Follow is the verify progress copied from my shell. From my observation, there are flakes, but not failures. PS: How the community share test report ? (I have deleted the test report from this reply as it is too long. You could see it from initial edit.) |
1c5e5ee
to
3aac293
Compare
3aac293
to
602ff1d
Compare
602ff1d
to
e33fddf
Compare
|
The semantics of persistent recursive watch promise no child events on descendant nodes. When there are standard child watches on descendants of node being watches in persistent recursive mode, server will deliver child events to client inevitably. So we have to filter out child events for persistent recursive watches on client side.
e33fddf
to
ff4750b
Compare
cc @eolivelli @Randgalt @symat @maoling @arshadmohammad @anmolnar for reviews. |
cc @eolivelli @Randgalt @symat @maoling @arshadmohammad @anmolnar @ztzg for reviews. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We now have zookeeper-compatibility-tests-curator and I think it's OK to merge now.
Pending to merge if no more objection this week. |
@tisonkun in ZooKeeper we do not allow to merge this kind of changes if there are not at least 2 sponsors. Unfortunately currently there are not many active reviewers, but please always wait for a second approval before merging non trivial patches |
@eolivelli OK. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This is kind of a breaking change and we should deliver it only on 3.9.0 and not cherry-pick to 3.8.x
@eolivelli I agree that it changes the event delivered and am OK to deliver it on 3.9.0, while it can be regarded as a bug fix since in 3.6.0 release notes we write:
|
Cause:
NodeChildrenChanged
due to child watcher on recursive watching node's descendants.Changes: Filter out
NodeChildrenChanged
events for recursive watcher in client side.